//
//  NavigationDemo.m
//  Exercise
//
//  Created by zhouxiaobo on 15/11/13.
//  Copyright © 2015年 mapath. All rights reserved.
//

#import "NavigationDemo.h"
#import "NavigationSubDemo.h"

@implementation NavigationDemo

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.title = @"导航测试";
    
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn.frame = CGRectMake(screenWidth/2 - 40, 120, 80, 30);
    btn.backgroundColor = [UIColor redColor];
    [btn setTitleColor:[UIColor greenColor] forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor greenColor] forState:UIControlStateHighlighted];
    [btn setTitle:@"Push" forState:UIControlStateNormal];
    [btn setTitle:@"Push" forState:UIControlStateHighlighted];
    [btn addTarget:self action:@selector(goNext) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];
    
    
    UIButton *btn1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn1.frame = CGRectMake(screenWidth/2 - 40, 200, 80, 30);
    btn1.backgroundColor = [UIColor redColor];
    [btn1 setTitleColor:[UIColor greenColor] forState:UIControlStateNormal];
    [btn1 setTitleColor:[UIColor greenColor] forState:UIControlStateHighlighted];
    [btn1 setTitle:@"Hidden" forState:UIControlStateNormal];
    [btn1 setTitle:@"Hidden" forState:UIControlStateHighlighted];
    [btn1 addTarget:self action:@selector(hidden) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn1];
}

- (void)goNext {
    NavigationSubDemo *navigationSubDemo = [[NavigationSubDemo alloc]init];
    [self.navigationController pushViewController:navigationSubDemo animated:YES];
}

- (void)hidden {
    if (self.navigationController.toolbarHidden){
        //self.navigationController.toolbarHidden = NO;
        [self.navigationController setNavigationBarHidden:NO animated:YES];
        [self.navigationController setToolbarHidden:NO animated:YES];
    }else{
        //self.navigationController.toolbarHidden = YES;
        [self.navigationController setNavigationBarHidden:YES animated:YES];
        [self.navigationController setToolbarHidden:YES animated:YES];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}


@end
